<!DOCTYPE html>
<html>
<head>
  <title>iframe-src-data</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

<iframe id="ifm"></iframe>

</body>
<script type="text/javascript">
  
document.getElementById("ifm").src = "data:text/html;uft8," + encodeURIComponent("<h1>hello world</h1>");

</script>
</html>